﻿
Partial Class events_admin_addEvent
    Inherits System.Web.UI.Page

    Private _itemID As Integer
    Public Property itemID() As Integer
        Get
            Return _itemID
        End Get
        Set(ByVal value As Integer)
            _itemID = value
        End Set
    End Property

    Private _action As String
    Public Property action() As String
        Get
            Return _action
        End Get
        Set(ByVal value As String)
            _action = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        itemID = Request.QueryString("familyId")
        action = Request.QueryString("Action")

        If action = "Edit" Then
            frmEvent.DefaultMode = FormViewMode.Edit
        ElseIf action = "Add" Then
            frmEvent.DefaultMode = FormViewMode.Insert
        End If

        If Not Page.IsPostBack Then
        End If
    End Sub

    Protected Sub frmEvent_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles frmEvent.ItemInserting

        Dim itemFrmView As FormView = CType(sender, FormView)
        Dim row As FormViewRow = itemFrmView.Row
        Dim txtTitle As TextBox = CType(row.FindControl("txtTitle"), TextBox)
        Dim txtDesc As TextBox = CType(row.FindControl("txtDesc"), TextBox)
        Dim txtDate As TextBox = CType(row.FindControl("txtDate"), TextBox)
        Dim txtLocation As TextBox = CType(row.FindControl("txtLocation"), TextBox)
        Dim txtAddress As TextBox = CType(row.FindControl("txtAddress"), TextBox)
        Dim txtCity As TextBox = CType(row.FindControl("txtCity"), TextBox)
        Dim txtState As TextBox = CType(row.FindControl("txtState"), TextBox)
        Dim txtZip As TextBox = CType(row.FindControl("txtZip"), TextBox)
        Dim chkHasAlbum As CheckBox = CType(row.FindControl("chkHasAlbum"), CheckBox)
        Dim chkArchive As CheckBox = CType(row.FindControl("chkArchive"), CheckBox)
        Dim chkPrivate As CheckBox = CType(row.FindControl("chkPrivate"), CheckBox)



        e.Values.Add("UserId", User.Identity.Name)
        e.Values.Add("hasAlbum", chkHasAlbum.Checked)

    End Sub

    Protected Sub frmEvent_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertedEventArgs) Handles frmEvent.ItemInserted
        Response.Redirect("/events/admin/default.aspx")
    End Sub




End Class
